<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title>我的评论 - 知识库</title>
    <style>
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f5f5f5; color: #1a1a1a; }
        .container { max-width: 900px; margin: 40px auto; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px #0001; padding: 32px; }
        .section-title { font-size: 20px; font-weight: 600; margin: 32px 0 16px 0; }
        .comment-table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fafafa; border-radius: 8px; box-shadow: 0 2px 8px #0001; margin-bottom: 32px; }
        .comment-table th, .comment-table td { padding: 12px 8px; border-bottom: 1px solid #eee; }
        .comment-table th { background: #f5f5f5; font-weight: 600; }
        .comment-table tr:last-child td { border-bottom: none; }
        .empty-tip { color: #888; text-align: center; padding: 32px 0; }
        a { color: #1a1a1a; text-decoration: none; }
        a:hover { text-decoration: underline; }
    </style>
</head>
<body>
<div class="container">
    <div class="section-title">我的评论</div>
    <c:choose>
        <c:when test="${not empty commentGroups}">
            <c:forEach var="entry" items="${commentGroups}">
                <div style="margin-bottom: 16px; font-weight: bold;">文档：<a href="/document/detail/${entry.key}">${entry.value[0].docTitle}</a></div>
                <table class="comment-table">
                    <thead>
                        <tr><th>内容</th><th>时间</th><th>操作</th></tr>
                    </thead>
                    <tbody>
                        <c:forEach var="comment" items="${entry.value}">
                            <tr>
                                <td>${comment.content}</td>
                                <td>${fn:substring(comment.createdAt, 0, 19)}</td>
                                <td><a href="/document/detail/${comment.docId}">查看文档</a></td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>
            </c:forEach>
        </c:when>
        <c:otherwise>
            <div class="empty-tip">你还没有发表过评论。</div>
        </c:otherwise>
    </c:choose>
</div>
</body>
</html> 